package cn.seaboot.admin.flake.web;

import cn.seaboot.admin.flake.manager.FlakeExecutor;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 查询字段配置前端表单配置 [t_store_form] Controller
 *
 * @author Mr.css
 * @version 2022-02-25 17:14
 */
@Controller
@Tag(name = "查询字段配置前端表单配置 [t_store_form] 管理")
@RequestMapping("sys/flake")
public class FlakeExecutorCtrl {

    @Resource
    private FlakeExecutor flakeExecutor;

    /**
     * 执行一个配置好的脚本
     *
     * @param params 参数
     * @return PageInfo
     */
    @ResponseBody
    @Operation(description = "执行一个配置脚本")
    @RequestMapping(value = "execute/{group}/{id}", method = RequestMethod.GET)
    public Object queryList(
            @PathVariable String group, @PathVariable String id,
            @RequestParam Map<String, Object> params) {
        return flakeExecutor.executeQuery(group, id, params);
    }
}
